package pzl.com.threadlocal.utils;

import pzl.com.threadlocal.beans.Index;

/**
 * @author zl.peng
 * @version [1.0, 2016-11-15]
 */
public class Util2 {

    private static Index num = new Index();
    //创建一个Index类型的本地变量
    private static ThreadLocal<Index> local = new ThreadLocal<Index>() {
        @Override
        protected Index initialValue() {
            return new Index();
        }
    };

    public static ThreadLocal<Index> getLocal() {
        return local;
    }

}
